<?php

namespace frontend\modules\orders\models;

use Yii;

/**
 * This is the model class for table "cservice".
 *
 * @property string $cservice_id
 * @property string $order_goods_id
 * @property string $content
 * @property integer $cservice_type
 * @property string $images
 * @property string $is_deal
 * @property string $created_at
 * @property string $user_id
 * @property string $cservice_code
 */
class Cservice extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'cservice';
    }

    /**
     * @inheritdoc
     */
    public function behaviors()
    {
        return [
//            TimestampBehavior::className(),
            // 名为myBehavior4的行为，也是给出了MyBehavior类的配置数组
            'uuid' => [
                'class' => \common\behavior\uuidBehavior::className(),
                'owner' => $this
            ]
        ];
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            ['cservice_id','default','value'=>$this->getUUID()],
            ['created_at','default','value'=>time()],
            [['cservice_id', 'order_goods_id'], 'required'],
            [['content','cservice_code'], 'string'],
            [['cservice_type','is_deal','created_at'], 'integer'],
            [['cservice_id', 'order_goods_id','user_id'], 'string', 'max' => 40],
            [['images'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'cservice_id' => 'Cservice ID',
            'order_goods_id' => 'Order Goods ID',
            'content' => 'Content',
            'cservice_type' => 'Cservice Type',
            'images' => 'Images',
            'cservice_code'=>'cservice_code'
        ];
    }

    /**
     * @inheritdoc
     * @return \frontend\modules\orders\models\query\CserviceQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new \frontend\modules\orders\models\query\CserviceQuery(get_called_class());
    }
}
